package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._12状态模式._3工作状态;

//晚间工作状态
class EveningState extends State {
    public void writeProgram(Work w)
    {
        if (w.getWorkFinished())  
        {
            w.setState(new RestState());
            w.writeProgram();
        }
        else
        {
            if (w.getHour() < 21) {
               System.out.println("当前时间："+ w.getHour() +"点 加班哦，疲累之极");
            }
            else {
              w.setState(new SleepingState());
              w.writeProgram();
            }
        }
    }
}